1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module sourceview.Gutter; 26 27 private import gobject.ObjectG; 28 private import gtk.AccessibleIF; 29 private import gtk.AccessibleT; 30 private import gtk.BuildableIF; 31 private import gtk.BuildableT; 32 private import gtk.ConstraintTargetIF; 33 private import gtk.ConstraintTargetT; 34 private import gtk.Widget; 35 private import sourceview.GutterRenderer; 36 private import sourceview.View; 37 private import sourceview.c.functions; 38 public import sourceview.c.types; 39 40 41 /** 42 * Gutter object for [class@View]. 43 * 44 * The `GtkSourceGutter` object represents the left or right gutter of the text 45 * view. It is used by [class@View] to draw the line numbers and 46 * [class@Mark]s that might be present on a line. By packing 47 * additional [class@GutterRenderer] objects in the gutter, you can extend the 48 * gutter with your own custom drawings. 49 * 50 * To get a `GtkSourceGutter`, use the [method@View.get_gutter] function. 51 * 52 * The gutter works very much the same way as cells rendered in a [class@Gtk.TreeView]. 53 * The concept is similar, with the exception that the gutter does not have an 54 * underlying [iface@Gtk.TreeModel]. The builtin line number renderer is at position 55 * %GTK_SOURCE_VIEW_GUTTER_POSITION_LINES (-30) and the marks renderer is at 56 * %GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS (-20). The gutter sorts the renderers 57 * in ascending order, from left to right. So the marks are displayed on the 58 * right of the line numbers. 59 */ 60 public class Gutter : Widget 61 { 62 /** the main Gtk struct */ 63 protected GtkSourceGutter* gtkSourceGutter; 64 65 /** Get the main Gtk struct */ 66 public GtkSourceGutter* getGutterStruct(bool transferOwnership = false) 67 { 68 if (transferOwnership) 69 ownedRef = false; 70 return gtkSourceGutter; 71 } 72 73 /** the main Gtk struct as a void* */ 74 protected override void* getStruct() 75 { 76 return cast(void*)gtkSourceGutter; 77 } 78 79 /** 80 * Sets our main struct and passes it to the parent class. 81 */ 82 public this (GtkSourceGutter* gtkSourceGutter, bool ownedRef = false) 83 { 84 this.gtkSourceGutter = gtkSourceGutter; 85 super(cast(GtkWidget*)gtkSourceGutter, ownedRef); 86 } 87 88 89 /** */ 90 public static GType getType() 91 { 92 return gtk_source_gutter_get_type(); 93 } 94 95 /** 96 * Returns: the associated #GtkSourceView. 97 */ 98 public View getView() 99 { 100 auto __p = gtk_source_gutter_get_view(gtkSourceGutter); 101 102 if(__p is null) 103 { 104 return null; 105 } 106 107 return ObjectG.getDObject!(View)(cast(GtkSourceView*) __p); 108 } 109 110 /** 111 * Insert @renderer into the gutter. If @renderer is yet unowned then gutter 112 * claims its ownership. Otherwise just increases renderer's reference count. 113 * @renderer cannot be already inserted to another gutter. 114 * 115 * Params: 116 * renderer = a gutter renderer (must inherit from #GtkSourceGutterRenderer). 117 * position = the renderer position. 118 * 119 * Returns: %TRUE if operation succeeded. Otherwise %FALSE. 120 */ 121 public bool insert(GutterRenderer renderer, int position) 122 { 123 return gtk_source_gutter_insert(gtkSourceGutter, (renderer is null) ? null : renderer.getGutterRendererStruct(), position) != 0; 124 } 125 126 /** */ 127 public void remove(GutterRenderer renderer) 128 { 129 gtk_source_gutter_remove(gtkSourceGutter, (renderer is null) ? null : renderer.getGutterRendererStruct()); 130 } 131 132 /** 133 * Reorders @renderer in @gutter to new @position. 134 * 135 * Params: 136 * renderer = a #GtkCellRenderer. 137 * position = the new renderer position. 138 */ 139 public void reorder(GutterRenderer renderer, int position) 140 { 141 gtk_source_gutter_reorder(gtkSourceGutter, (renderer is null) ? null : renderer.getGutterRendererStruct(), position); 142 } 143 }